<?php
namespace app\common\controller;

use app\common\controller\Base;

class Front extends Base
{
    //继承上级
    protected function initialize()
    {
        parent::initialize();
        
        $this->authCheck();

        if($this->site['action'] == 'index'){
            model('common/User','loglic')->pidSet();
        }
        
        if($this->request->isMobile()){
            $this->site['theme']  = 'mobile';
        }

        $this->site['pathView']   = $this->site['rootUrl'].'/view/'.$this->site['theme'];

        $this->view->config('view_base', './view/'.$this->site['theme'].'/');

        $this->assign($this->user);
    }

    //积分验证
    protected function scoreValidate($scoreTotal=0)
    {
        $modelScore = model('common/Score','loglic');
        if( !$modelScore->validateConfig($this->user['user_score'], $scoreTotal) ){
            $this->error($modelScore->getError(),'user/index/index');
        }
    }
}